import request from '@/utils/request'

export default {

    /***
     *  添加 课程基本信息
     */
    saveCourse(courseInfo){

        return request({
            url:'/eduservice/course/add/course/info',
            method:'post',
            data:courseInfo
        });
    },

    /**
     *  查询所有讲师集合
     */
    getTeacherList(){

        return request({
            url:'/eduservice/teacher/findAll',
            method:'get'
        });
    },
    
    /**
     *  根据id 查询 课程的信息
     * @param {*} courseId  课程id
     */
    getCourseById(courseId){

        return request({
            url:'/eduservice/course/get/courseinfo/by/'+courseId,
            method:'get'
        });
    },

    /**
     *   修改课程的信息
     * @param {*} courseInfo 课程信息
     */
    editCourseInfo(courseInfo){
        
        return request({
            url:'/eduservice/course/edit/courseinfo',
            method:'post',
            data:courseInfo
        });
    },

    /**
     * 
     * 获取最终发布的课程信息
     * @param {*} courseId 课程id
     */
    getCoursePublish(courseId){
        return request({
            url:'/eduservice/course/get/course/publish/by/'+courseId,
            method:'get',
        });
    },
    
    /** 
     *  发布课程，将课程status 设置为 Normal 已发布状态
     * @param {*} courseId 课程id
     */
    publishCourseById(courseId){
        return request({
            url:'/eduservice/course/alter/course/status/'+courseId,
            method:'get',
        });
    },

    /**
     *  查询 所有课程
     *  TODO 完善  条件+分页查询
     * 
     */
    getCourseList(){
        return request({
            url:'/eduservice/course/get/course/list',
            method:'get',
        });
    },

    /**
     *   删除课程相关的信息
     * @param {*} courseId 课程id
     */
    removeCourseInfo(courseId){
        return request({
            url:'/eduservice/course/remove/course/by/'+courseId,
            method:'delete',
        });
    },
    /**
     * 
     * @param {*} page  页码
     * @param {*} size  条数
     * @param {*} courseQuery   查询条件
     */
    getCOurseListPage(page,size,courseQuery){
        return request({
            url:'/eduservice/course/find/course/page/list/'+page+'/'+size,
            method:'post',
            data:courseQuery 
        });
    }
}